package com.icode.core.model.house;

import com.icode.core.dto.house.HouseExtraFeeDTO;
import com.icode.core.model.AbstractEntity;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * Created with IntelliJ IDEA.
 * User: xianfei
 * Date: 15-10-26
 * Time: 上午11:27
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name = "house_extra_fee")
public class HouseExtraFee extends AbstractEntity {

    @ManyToOne
    @JoinColumn(name = "house_info_id")
    private HouseInfo houseInfo;

    private String title;
    private String price;

    public HouseExtraFee() {
    }

    public HouseExtraFee(HouseInfo houseInfo, String title, String price) {
        this.houseInfo = houseInfo;
        this.title = title;
        this.price = price;
    }

    public HouseInfo houseInfo() {
        return houseInfo;
    }

    public String title() {
        return title;
    }

    public String price() {
        return price;
    }

    public void update(HouseExtraFeeDTO houseExtraFeeDTO) {
        this.title = houseExtraFeeDTO.getTitle();
        this.price = houseExtraFeeDTO.getPrice();
    }
}
